//
//  DynamicCellViewModel.m
//  BigJoy
//
//  Created by Rowling on 2017/7/14.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "DynamicCellViewModel.h"



@implementation DynamicCellViewModel

-(CGFloat)cellHeight {
    if (_cellHeight == 0) {
        _cellHeight = 83 + 50;
    }
    return _cellHeight;
}

-(void)setImageArray:(NSArray *)imageArray {
    _imageArray = imageArray;
    if (imageArray.count == 0) {
        
    }else if (imageArray.count == 1){
        CGFloat heigh = (SCREEN_WIDTH - 30) * [_imageArray firstObject].size.height / [_imageArray firstObject].size.width;
        self.cellHeight += heigh;
        self.singleH = heigh;
        self.singleW = (SCREEN_WIDTH - 30);
    }else if (imageArray.count > 1) {
        CGFloat wh = (SCREEN_WIDTH - 30 - 20) / 3;
        self.moreWH = wh;
        self.cellHeight += (imageArray.count >=9 ? 9 : imageArray.count / 3 + 1) * (wh +10);
    }
}

-(void)setPinlunArray:(NSArray *)pinlunArray {
    _pinlunArray = pinlunArray;
    if (pinlunArray.count == 1) {
        self.pinlunH = 30;
        self.cellHeight += 30;
    }
    if (pinlunArray.count == 2) {
        self.pinlunH = 60;
        self.cellHeight += 60;
    }
    if (pinlunArray.count > 2) {
        self.pinlunH = 80;
        self.cellHeight += 80;
    }
}

-(void)setContentStr:(NSString *)contentStr {
    _contentStr = contentStr;
    CGFloat heigh = [XMSuperHelper LabelHeight:contentStr Width:(SCREEN_WIDTH - 30) Font:[UIFont systemFontOfSize:13]] - 12;
    self.headHeight = 83 + heigh;
    self.cellHeight += heigh;
}
@end
